# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
import sys

sys.path.extend(["F:/ML/BNC", "D:/BNC", "/www/wwwroot/BNC"])
# Create your tests here.
import requests, json

# def test_market_temp():
#     req_dic = {'startDate': '20191217', 'endDate': '20191220'}
#     _url = 'http://127.0.0.1:8000/blog/market-temperature'
#     data = requests.get(url=_url, params=req_dic)
#     print("data response :{} from {}".format(data.text, _url))

# test_market_temp()
# from blog.models import *
from WebServer.blog.models import *

code_ = 'test_code'
origin_ = 'test_tag'
date_ = datetime.date.today()
storage_date_ = datetime.date.today()
mc_sp = origin_[:-1]


class ReplayDataTestCase(TestCase):  # 继承自TestCase

    def create_replay(cls):
        # 需要测试默认值的问题
        tag = TagRename.objects.get_or_create(origin=origin_, storage_date=storage_date_,
                                              to=TagStatus.objects.get_or_create(tag=mc_sp,
                                                                                 storage_date=storage_date_)[0])[0]
        CodeTagDate.objects.create(code='test', tag=tag, date=date_, storage_date=storage_date_)

    def setUp(self):  # 可以理解成是重写的__init__方法
        tag = TagRename.objects.get_or_create(origin=origin_, storage_date=storage_date_,
                                              to=TagStatus.objects.get_or_create(tag=mc_sp,
                                                                                 storage_date=storage_date_)[0])[0]
        CodeTagDate.objects.create(code='test', tag=tag, date=date_, storage_date=storage_date_)
        print("test")
        for i_ in CodeTagDate.objects.all():
            print(i_)

    def test_animals_can_speak(self):
        self.assertEqual("", "", "not equal")
        pass
